package org.lynn;

import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 *
 * Created by sang on 16-12-22.
 */
@RestController
public class WsController {

    @MessageMapping("/welcome")
    @SendTo("/topic/getResponse")
    public ResponseMessage say(RequestMessage message, HttpServletResponse response) {

        response.setHeader("Lynn","test");
        response.setHeader("refresh","1");

        System.out.println(message.getName());
        return new ResponseMessage("welcome," + message.getName() + " !");
    }



}
